#!/sbin/openrc-run

name="Greenbone Vulnerability Manager"
command=/usr/bin/gvmd

: ${GVMD_USER:=gvm}
: ${GVMD_GROUP:=gvm}
: ${GVMD_TIMEOUT:=30}
: ${GVMD_LISTEN_ADDRESS_UNIX:=/run/gvmd/gvmd.sock}
: ${GVMD_SCANNER_HOST:=/run/ospd/ospd.sock}
: ${GVMD_LISTEN_OWNER:=$GVMD_USER}
: ${GVMD_LISTEN_GROUP=$GVMD_GROUP}
: ${GVMD_LISTEN_MODE:=755}
: ${GVMD_GNUTLS_PRIORITIES:=NORMAL}
: ${GVMD_LISTEN_ADDRESS_TCP:=127.0.0.1}
: ${GVMD_PORT:=9390}

command_user="${GVMD_USER}:${GVMD_GROUP}"
retry="${GVMD_TIMEOUT}"
command_args="${GVMD_OPTIONS} --listen=${GVMD_LISTEN_ADDRESS_TCP} --port=${GVMD_PORT} --scanner-host=${GVMD_SCANNER_HOST} --gnutls-priorities=${GVMD_GNUTLS_PRIORITIES}"

depend() {
	after firewall
	need net ospd-openvas
}

start_pre() {
	checkpath --directory --mode 775 --owner "$command_user" /run/gvmd /var/log/gvm
}
